var DWZ=parent.DWZ;
var itemId=0;
$(document).ready(function(){	
	alert("in method");
	itemId = $.getParam("item_id");
	getTab();	
});

var choiceTabs={};
function getTayout(){
	var url="/demo/tab";
	DWZ.get(url,function(msg){
		var tabContainer=$("#tabContainer");
		var templet = $("#templet").html();
		var tabs = msg.result||[];
		$.each(tabs,function(i,tab){
			var row = templet.replace(/\${title}/g,tab.title);
			var container = tab.container;
			var items=[];
			$.each(tab.items,function(j,item){
				items.push(item.templet);
			})
			container=container.replace(/\${container}/,items.join(""));
			row=row.replace(/\${container}/,container);
			
			row=$(row);
			
			$(">div[name=head] input[type=checkbox]",row).click(function(e){
				if(this.checked){
					choiceTabs["tab_id"+tab.tab_id]={
						data:tab,
						demo:container
					}
					$(this).parents("div[name=head]").next().css("border","red 1px solid");
				}else{
					delete choiceTabs["tab_id"+tab.tab_id];
					$(this).parents("div[name=head]").next().css("border","red 0px solid");
				}
			});//.data("tab",container);
			
			row.appendTo(tabContainer);
		})
	})
}

/**
 * 执行选择操作
 */
function choice(){
	if(callback)callback(choiceTabs);
}